<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('inventory_plan', function (Blueprint $table) {
            $table->id()->unique()->comment('自增id');
$table->string('plan_no', 100)->comment('盘点方案编码');
$table->string('plan_name', 100)->comment('盘点方案名称');
$table->tinyInteger('status')->comment('状态：0未审，1已审');
$table->string('org_code', 20)->comment('库存组织代码');
$table->text('remark')->nullable()->comment('备注');
$table->tinyInteger('split_order_rules')->comment('分单规则：1按照仓库分单盘点');
$table->tinyInteger('allow_new_material')->default(1)->comment('物料盘点作业是否允许新增物料：0否，1是');
$table->tinyInteger('no_check_order')->default(0)->comment('是否忽略库存单据审核状态检测');
$table->tinyInteger('create_adjust_order')->default(1)->comment('是否生成盘盈盘亏单');
$table->decimal('default_qty')->default(0)->comment('实盘数默认值');
$table->integer('inventory_eadline')->default(0)->comment('库存截止时间');
$table->json('wms_range')->nullable()->comment('仓位盘点范围');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();

$table->engine='InnoDB';
$table->comment('盘点方案');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('inventory_plan');
    }
};
